import { defHttp } from '@/utils/http/axios';
import { IDeviceDispenseData, IDeviceListResult } from './type';
enum Api {
  deviceList = '/im/hanyin/device/manage/list',
  deviceAdd = '/im/hanyin/device/manage/add',
  deviceUpdate = '/im/hanyin/device/manage/update',
  deviceDelete = '/im/hanyin/device/manage/delete',
  deviceDispense = '/im/hanyin/device/manage/dispense',
  deviceStatistics = '/im/hanyin/device/manage/stats',
}

//设备列表
export function DeviceList(params) {
  return defHttp.get<IDeviceListResult[]>({
    url: Api.deviceList,
    params,
  });
}

//设备新增
export function DeviceAdd(data) {
  return defHttp.post({
    url: Api.deviceAdd,
    data,
  });
}

//设备编辑
export function DeviceUpdate(data) {
  return defHttp.post({
    url: Api.deviceUpdate,
    data,
  });
}

//设备删除
export function DeviceDelete(data) {
  return defHttp.post({
    url: Api.deviceDelete,
    data,
  });
}

//分配、回收设备
export function DeviceDispense(data: IDeviceDispenseData) {
  return defHttp.post({
    url: Api.deviceDispense,
    data,
  });
}

// 设备统计
export function DeviceStatistics() {
  return defHttp.get({
    url: Api.deviceStatistics,
  });
}
